import request from '/@/utils/request';

/**
 * 
 * @method getUserInfo 从后台获取用户信息
 * 
 */
export function menuApi() {
	return {
		getMenuList: (params?: object) => {
			return request({
				url: '/api/menu/list',
				method: 'GET',
				params
			}).then(res =>{
				if (res.data.code === "000000") {
					return Promise.resolve(res.data);
				} else {
					return Promise.reject(res.data);
				}
			});
		},
		getMenuSuperior: (params?: object) => {
			return request({
				url: '/api/menu/superior',
				method: 'GET',
				params
			}).then(res =>{
				if (res.data.code === "000000") {
					return Promise.resolve(res.data);
				} else {
					return Promise.reject(res.data);
				}
			});
		},
		save: (params: object) => {
			return request({
				url: '/api/menu/save',
				method: 'POST',
				data:params
			})
		},
		delete: (params: object) => {
			return request({
				url: '/api/menu/delete',
				method: 'GET',
				params
			})
		},
	};
}
